package com.xyy.saas.payment.job.syncData;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.simple.SimpleJob;
import com.xyy.elasticjob.client.annotation.ElasticJobConf;
import com.xyy.saas.payment.service.job.impl.DownloadTradeBillService;
import com.xyy.saas.payment.service.job.impl.PinganTradeCheckBillService;
import com.xyy.saas.payment.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.ParseException;

@ElasticJobConf(name = "xyy.elastic.job.manage.PinganTradeCheckBillJob", cron = "0 30 8 * * ?")
@Slf4j
public class PinganTradeCheckBillJob implements SimpleJob {
    @Autowired
    private PinganTradeCheckBillService pinganTradeCheckBillService;

    @Override
    public void execute(ShardingContext shardingContext) {
        log.info("PinganTradeCheckBillJob#execute start");

        try {
            pinganTradeCheckBillService.download(DateUtil.getDay(-1), false);
        } catch (Exception e) {
            log.error("PinganTradeCheckBillJob#execute error", e);
        }

        log.info("PinganTradeCheckBillJob#execute end");
    }

}
